package com.byyy.ccts.modules.api.convert;

import com.byyy.ccts.modules.api.entity.OwnerVo;
import com.byyy.ccts.modules.api.entity.WarehouseVo;
import com.byyy.ccts.modules.sys.entity.Cangku;
import com.byyy.ccts.modules.sys.entity.Huoz;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @projectName: TODO
 * @package: com.byyy.ccts.modules.api.convert
 * @className: CangkuConvert
 * @description: TODO
 * @author: LYB
 * @Date: 2023-01-10 9:34
 * @updateUser: LYB
 * @updateDate: 2023-01-10 9:34
 * @updateRemark:
 * @version: v1.0
 */
@Mapper(componentModel = "spring")
public interface HuozConvert {

    HuozConvert INSTANCE = Mappers.getMapper(HuozConvert.class);

    @Mappings({
            @Mapping(source = ".", target = "id"),
            @Mapping(source = "ownerCode", target = "huozId"),
            @Mapping(source = "ownerName", target = "huozName"),
            @Mapping(source = "whCode", target = "cangku"),
            @Mapping(source = "companyCode", target = "yezId")
    })
    Huoz ownerToHuoz(OwnerVo ownerVo);

    default String getId(OwnerVo ownerVo) {
        return ownerVo.getOwnerCode() + ownerVo.getWhCode();
    }
}
